
// usage: type myfile | sed s/abc/def | sed s/\s+/

using System;
using System.IO;
using System.Text.RegularExpressions;

namespace SDET.Util
{
    public class sed
    {
        public static void Main(string[] args)
        {
            string line, pattern, s;
            string[] splits;
            TextReader __in__;
            Regex regex;

            if (args.Length != 1) return;

            splits = args[0].Split('/');
            if (splits[0] !="s")  return; 

            pattern  = splits[1];
            s        = splits[2];

            __in__ = Console.In;
            regex = new Regex(pattern);

            while(__in__.Peek() != -1)
            {
               line = __in__.ReadLine();
               Console.WriteLine ("{0}", regex.Replace(line, s));
            }

            __in__.Close();
        }
    }
}